Ext.define('Sencha.controller.TabBarController', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
           
            infoTabContainer: 'container[name=infotabcontainer]',
            logoButton: 'button[cls=logoButton]'
        },
        
        control: {
            'logoButton' :{
           		tap: 'onLogoButtonTap'
            },
            'infoTabContainer' : {
                //initialize: 'onInit',
                //activate: 'onShow',
                //deactivate: 'onHide'
           }
        }
    },
/*
    launch: function() { 
        // Setup event handlers here because Sencha bug? causes activate to be fired twice  
        this.infoTabContainer().on({
            activate  : { fn: this.onShow, scope: this },
            deactivate: { fn: this.onHide, scope: this }
        });                      
    },
*/           
           
    onShow: function() {
           
        console.log('TabBarController.onShow()');
          // this.getInfoTabContainer().add({xtype: 'informationlistview'});
        //var newContainer = Ext.create('Sencha.view.InformationListView');
           console.log('test text = ' + this.getInfoTabContainer().getHtml() );
           
           var infoList = {
                xtype: "informationlistview"
           };
           
           var engButton = {
           xtype: "button",
           /*text: 'ENG',*/
           cls: 'engDictionaryButton',
           id: 'engDictionaryButtonId'
           };
           
           //this.getInfoTabContainer().add([infoList, engButton]);
           this.getInfoTabContainer().push(infoList);
        
           
        
        //informationlistview
           
           
        /*
        //this.getMain().push( this.getInfoListViewRef() );
        this.getMain().add( this.getInfoListViewRef() );
        console.log('end of show, num items = ' + this.getMain().getItems().length);
         */
    },
           
    onHide: function() {
        console.log('TabBarController.hide()');
           /*
        this.getMain().removeAt(1);
        console.log('end of hide, num items = ' + this.getMain().getItems().length);
        */
    },
           
    onInit: function() {
        console.log ('TabBarController.onInit()...');
         /*  
        this.setInfoListViewRef( { 
            xtype: 'informationlistview',
            title: 'information'
        });
          */
    },
           
           
           
    // Handle tap event on logo button located on TabPanel tab bar
    //
    onLogoButtonTap : function() {
        location.href='http://www.iwaidja.org/';
    }
           
});
